<!-- 父组件 -->
<template>
    <div>
        <h3>App</h3>
        <button @click="fn">vm</button>
        <hr>
        <Child ref="child"></Child>
    </div>
</template>

<script>
import Child from '@/components/Child.vue'

export default {
    components: {Child},
    methods: {
        fn() {
            console.log(this.$refs)
            if (this.$refs.child.addNum) this.$refs.child.addNum()
        }
    }
}
</script>